home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
pull5x.zip
/
PULLSTAT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-01-01
|
30KB
|
756 lines
{ =========================================================================== }
{ PullStat.pas - User Statistics for pull-down menus. ver 5.Xa, 01-11-89 }
{ }
{ This file contains all the data for GetUserPullStats, GetOverrideStats and }
{ CheckGlobalKeys to configure the menus. }
{ Copyright (c) 1987-1989 James H. LeMay, All rights reserved. }
{ =========================================================================== }
{ R-,S-,I-,D-,T-,F-,V-,B-,N-,L+ } { TP4 directives }
{$A-,B-,D-,E-,F-,I-,L-,N-,O-,R-,S-,V-} { TP5 directives }
{$define UseSubMenuCode }
{$define UseHelpWndwCode }
{$define UseDataEntryCode }
{$define UseMsgLineCode }
UNIT PullStat;
INTERFACE
uses
Crt,Qwik,Wutil,Wndw,Pull,PullDir;
{ ------------------ Set up your window names here in order: ---------------- }
{ This is optional, but it sure helps you in not only understanding the
program, but also makes it unquestionably easier to rearrange. }
type
MainMenuNames = (NoMainMenu,FilesMenu,ColorMenu,AutoPartsMenu,EnterDataMenu,
OptionsMenu,UtilitiesMenu,IRSmenu,QuitMenu);
{$ifdef UseSubMenuCode }
SubMenuNames = (NoSubMenu,TiresMenu,RadioMenu,UpdateMenu,DateMenu,
BrandsMenu);
{$endif }
{$ifdef UseDataEntryCode }
DataWndwNames = (NoDW,BytesDW,WordsDW,IntegersDW,LongIntsDW,RealsDW,HexDW,
CharsDW,StringsDW,PathDW,FileMaskDW,SeatsDW,PriceDW,MonthDW,
DayDW,YearDW,YearsDW);
{$endif }
{$ifdef UseHelpWndwCode }
HelpWndwNames = (NoHW,WorkWndwHW,TopLineHW,FilesMenuHW,DirMenuHW,
BrandsMenuHW,EnterDataMenuHW,IRSmenuHW,DateMenuHW,
UpdateMenuHW,ExecChoiceHW,SingleChoiceHW,MultipleChoiceHW,
NumericHW,TextHW);
HelpLineNames = (NoHL, { HL - HelpLine; L - Last }
HLw1,HLw2,HLw3,HLw4,HLw5,HLw6, { Work window }
HLw7,HLw8,HLw9,HLw10,HLwL,
HLt1,HLtL, { Top menu }
HLb1,HLb2,HLb3,HLb4,HLb5,HLbL, { Brands submenu }
HLf1,HLf2,HLf3,HLf4,HLf5, { Files submenu }
HLf6,HLf7,HLf8,HLf9,HLfL,
HLdir1,HLdir2,HLdir3,HLdir4,HLdir5, { Directory submenu }
HLdir6,HLdir7,HLdir8,HLdir9,HLdirL,
HLe1,HLe2,HLe3,HLe4,HLe5, { Enter data submenu }
HLe6,HLe7,HLe8,HLe9,HLe10,
HLe11,HLe12,HLe13,HLe14,HLeL,
HLi1,HLi2,HLiL, { IRS menu }
HLd1,HLd2,HLd3,HLdL, { Date submenu }
HLu1,HLu2,HLuL, { Update submenu }
HLx1,HLx2,HLxL, { eXecute choice menu }
HLs1,HLs2,HLsL, { Single choice menu }
HLm1,HLm2,HLmL, { Multiple choice menu }
HLn1,HLn2,HLn3,HLn4,HLn5,HLn6,HLnL, { Numeric data }
HLtx1,HLtx2,HLtx3,HLtx4,HLtx5,HLtx6,HLtxL); { Text data }
{$endif UseHelpWndwCode }
{$ifdef UseMsgLineCode }
MsgLineNames = (NoML,WorkML,TopML,AltML,MainML,SubML,DW_ML,DE_ML,
SeqML,HelpML,ProcML,DirML);
{$endif UseMsgLineCode }
const
FileName: string[12] = 'pulldemo.exe';
{ Careful! - Always test your last main menu, submenu, data window, and help
window for run-time error! It makes sure you have allotted enough memory
with your constants. The compiler cannot check it with these typed scalars.}
procedure GetUserPullStats;
procedure GetOverrideStats;
procedure CheckGlobalKeys;
IMPLEMENTATION
procedure GetMainMenu (Name: MainMenuNames);
begin
MRI := ord (Name);
TopMenu := MainMenu^[MRI];
end;
procedure SaveMainMenu;
begin
MainMenu^[MRI] := TopMenu;
end;
{$ifdef UseSubMenuCode }
procedure GetSubMenu (Name: SubMenuNames);
begin
MRI := ord (Name);
TopMenu := SubMenu^ [MRI];
end;
procedure SaveSubMenu;
begin
SubMenu^[MRI] := TopMenu;
end;
{$endif }
{$ifdef UseHelpWndwCode }
procedure SetHelpLines (Name: HelpWndwNames; First,Last: HelpLineNames);
begin
HelpWndw[ord(Name)].FirstLine := ord(First);
HelpWndw[ord(Name)].LastLine := ord(Last);
end;
{$endif }
{ ============================ EXEC PROCEDURES ============================== }
{ Place procedures for execution by menu pointers, ProcPtr, here. }
{ They MUST be set to FAR calls. }
{ --------------------------------------------------------------------------- }
{$F+}
procedure DummyProc;
begin
{$ifdef UseMsgLineCode }
ShowMsg (ord(ProcML));
{$endif UseMsgLineCode }
Delay (1000)
end;
procedure GotoDir;
begin
PullDown:=true;
MoreCmdSeq:='D';
end;
procedure DoDir;
begin
{ Use (FileName,FileName) to initially Hilite a close match. }
{ Use (FileName,'') to start at default. }
PullDirectory (FileName,FileName);
end;
procedure SetQuit;
begin
PopToWorkWndw := true;
Quit := true;
end;
procedure ProcessThenPop;
begin
{ Here's how to process and then pop the menus. }
DummyProc;
PopToWorkWndw := true;
end;
procedure PopThenProcess;
begin
{ Here's how to pop first and then process. }
if Popped then DummyProc;
end;
procedure PopProcessAndPull;
begin
{ Here's how to pop the menus first, process and then pull the same }
{ menus back again which is good for updating the work window. }
if Popped then DummyProc;
PullDown := true;
end;
procedure PopNumOfLevels;
begin
{ Here's how to pop by a number of levels so that part of the menus will }
{ remain displayed while going to another submenu. }
PopLevels := 1;
PullDown := true;
MoreCmdSeq := 'Y';
end;
procedure PopToNewMenu;
begin
{ Here's how to go to a completely different menu. }
PopToTop := true;
PullDown := true;
MoreCmdSeq := 'AR';
end;
procedure DateMenu1;
begin
PullDown := true;
MoreCmdSeq := 'D';
end;
procedure DateMenu2;
begin
PullDown := true;
MoreCmdSeq := 'Y';
end;
procedure DateMenu3;
begin
PopLevels := 1;
end;
{$F-}
{ ======================== GetUserPullStats ================================= }
{ The major configurations for all menus go here. The program first clears }
{ all RECORD values to $00. The values below will set new values. Therefore, }
{ setting RECORD values to "false" or the like is not necessary. }
{ --------------------------------------------------------------------------- }
procedure GetUserPullStats;
begin
LocationWarning:=true; { If true and a Submenu won't fit, a message is
displayed. If false, you can override the
location without the message. }
{ ------------------ Set up your colors and borders here: ---------------- }
TopLineAttr := Black+LightGrayBG;
TopLineHattr := White+BlackBG;
MainMenuBattr := LightGray+BlackBG;
MainMenuHattr := Black+LightGrayBG;
MainMenuLattr := Yellow+BlackBG;
MainMenuCattr := LightGray+BlackBG;
Brdr[UserBrdr1].BrdrArray := '╒═╕││└─┘╞═╡╤│┴╪';
MainMenuBrdr := UserBrdr1;
{$ifdef UseSubMenuCode }
SubMenuWattr := Black+CyanBG;
SubMenuBattr := Black+CyanBG;
SubMenuBrdr := SingleBrdr;
{$endif UseSubMenuCode }
if VideoMode=7 then
begin
TopLineLattr := TopLineAttr;
MainMenuWattr:= LightGray+BlackBG;
{$ifdef UseSubMenuCode }
SubMenuHattr := Black +LightGrayBG;
SubMenuLattr := White +BlackBG;
SubMenuCattr := LightGray+BlackBG;
{$endif UseSubMenuCode }
end
else
begin
TopLineLattr := Red +LightGrayBG;
MainMenuWattr:= White+BlackBG;
{$ifdef UseSubMenuCode }
SubMenuHattr := White+BlueBG;
SubMenuLattr := White+CyanBG;
SubMenuCattr := Blue +CyanBG;